/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.swa.testvalid.utils;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 *
 * @author felix
 */
public class EMailValidator implements ConstraintValidator<EMail, String>
{
  @Override
  public void initialize( EMail constraintAnnotation ) { }

  @Override
  public boolean isValid( String value, ConstraintValidatorContext context )
  {
    return value != null && value.matches( "[\\w|-]+@\\w[\\w|-]*\\.[a-z]{2,3}" );
  }
}